﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using TypeRacer.Models;


namespace TypeRacer.DAL
{
    public class DataInitializer : DropCreateDatabaseIfModelChanges<DataContext> 
    {
        protected override void Seed(DataContext context)
        {
            var list = new List<Book>()
                {
                    new Book(){Title = "China in Ten Words",Author = "Yu Hua, Allan H. Barr"},
                    new Book(){Title = "Killing Kennedy: The End of Camelot",Author = "Bill O'Reilly"},
                    new Book(){Title = "The World Until Yesterday: What Can We Learn from Traditional Societies?",Author = "Jared Diamond"}
                };
            list.ForEach(x=> context.Books.Add(x));
            context.SaveChanges();
        }
    }
}